import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

drive = webdriver.Chrome()
drive.maximize_window()
drive.get("https://sahitest.com/demo/iframesTest.htm")
time.sleep(3)
# 通过元素div进入iframe
ele = drive.find_element(By.CSS_SELECTOR, "body > iframe")
drive.switch_to.frame(ele)
drive.find_element(By.CSS_SELECTOR, "a[href='linkTest.htm']").click()
time.sleep(3)
drive.close()
